package com.tph.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


/**
 * 非分页查询的，结果统一类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class R {
    private int code;
    private String msg;
    private Object data;

    /**
     * 成功
     *
     * @param data 需要返回的数据
     */
    public static R ok(Object data) {
        return new R(0, "OK", data);
    }

    /**
     * 成功
     */
    public static R ok() {
        return ok(null);
    }

    /**
     * 失败
     */
    public static R fail(Object data) {
        return new R(1, "FAIL", data);
    }

    public static R fail() {
        return fail(null);
    }
}
